import 'osc_notice.dart';

class OscActiveListEntity {
	List<OscActive> activeList;
	OscNotice notice;

	OscActiveListEntity({this.activeList, this.notice});

	OscActiveListEntity.fromJson(Map<String, dynamic> json) {
		if (json['activelist'] != null) {
			activeList = new List<OscActive>();(json['activelist'] as List).forEach((v) { activeList.add(new OscActive.fromJson(v)); });
		}
		notice = json['notice'] != null ? new OscNotice.fromJson(json['notice']) : null;
	}

	Map<String, dynamic> toJson() {
		final Map<String, dynamic> data = new Map<String, dynamic>();
		if (this.activeList != null) {
      data['activelist'] =  this.activeList.map((v) => v.toJson()).toList();
    }
		if (this.notice != null) {
      data['notice'] = this.notice.toJson();
    }
		return data;
	}
}

class OscActive {
	String author;//发布者
	int catalog;//动态分类：1-新闻、2-问答区（发布帖子、回复帖子）、3-动弹、4-博客（发博客，评论）、0-其它
	String objectTitle;//动态对象标题(动弹为空 帖子,博客的标题)
	String tweetImage;//动弹图片，catalog 为 3 时（即为动弹时）才可能存在
	int objectCatalog;//动态对象分类：1-普通帖子（问答），2-城市圈活动，3-城市圈讨论，4-话题，5-对帖子评论的回复
	OscActiveObjectReply objectReply;
	String portrait;//发布者用户头像地址
	int authorId;//发布者ID
	String message;//动态对象内容
	String pubDate;//发布时间
	String url;//动态对象链接
	int objectType;//动态类型：1-开源软件、2-帖子、3-博客、4-新闻、5-代码、6-职位、7-翻译文章、8-翻译段落、16-新闻评论、17-讨论区答案、18-博客评论、19-代码评论、20-职位评论、21-翻译评论、32-职位评论、100-动弹、101-动弹回复
	int appClient;//客户端类型：1-WEB、2-WAP、3-Android、4-IOS、5-WP
	int commentCount;//评论数
	int id;//动态ID
	int objectId;//动态对象id：动弹 帖子 博客ID (根据objectType区分)

	OscActive({this.author, this.catalog, this.objectTitle, this.tweetImage, this.objectCatalog, this.objectReply, this.portrait, this.authorId, this.message, this.pubDate, this.url, this.objectType, this.appClient, this.commentCount, this.id, this.objectId});

	OscActive.fromJson(Map<String, dynamic> json) {
		author = json['author'];
		catalog = json['catalog'];
		objectTitle = json['objectTitle'];
		tweetImage = json['tweetImage'];
		objectCatalog = json['objectCatalog'];
		objectReply = json['objectReply'] != null ? new OscActiveObjectReply.fromJson(json['objectReply']) : null;
		portrait = json['portrait'];
		authorId = json['authorid'];
		message = json['message'];
		pubDate = json['pubDate'];
		url = json['url'];
		objectType = json['objectType'];
		appClient = json['appClient'];
		commentCount = json['commentCount'];
		id = json['id'];
		objectId = json['objectId'];
	}

	Map<String, dynamic> toJson() {
		final Map<String, dynamic> data = new Map<String, dynamic>();
		data['author'] = this.author;
		data['catalog'] = this.catalog;
		data['objectTitle'] = this.objectTitle;
		data['tweetImage'] = this.tweetImage;
		data['objectCatalog'] = this.objectCatalog;
		if (this.objectReply != null) {
      data['objectReply'] = this.objectReply.toJson();
    }
		data['portrait'] = this.portrait;
		data['authorid'] = this.authorId;
		data['message'] = this.message;
		data['pubDate'] = this.pubDate;
		data['url'] = this.url;
		data['objectType'] = this.objectType;
		data['appClient'] = this.appClient;
		data['commentCount'] = this.commentCount;
		data['id'] = this.id;
		data['objectId'] = this.objectId;
		return data;
	}
}

class OscActiveObjectReply {
	String objectName;//动态对象回复者名称
	String objectBody;//动态对象回复内容

	OscActiveObjectReply({this.objectName, this.objectBody});

	OscActiveObjectReply.fromJson(Map<String, dynamic> json) {
		objectName = json['objectName'];
		objectBody = json['objectBody'];
	}

	Map<String, dynamic> toJson() {
		final Map<String, dynamic> data = new Map<String, dynamic>();
		data['objectName'] = this.objectName;
		data['objectBody'] = this.objectBody;
		return data;
	}
}

